package com.hnichr.ump.schedule;

import com.hnichr.ump.schedule.job.assessment.SyncActivityJob;
import com.hnichr.ump.schedule.job.assessment.SyncTemplateJob;
import com.hnichr.ump.schedule.job.assessment.SyncTesteeStateAndResultJob;
import com.hnichr.ump.schedule.job.assessment.SyncTesteeUnSyncResultJob;
import com.hnichr.ump.schedule.job.talent.library.SyncHuanghehrResumeJob;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class ScheduleTask {

    private static final Logger logger = LoggerFactory.getLogger(ScheduleTask.class);

    @Autowired
    private SyncHuanghehrResumeJob huanghehrResumeJob;

    @Autowired
    private SyncTemplateJob syncTemplateJob;

    @Autowired
    private SyncTesteeStateAndResultJob syncTesteeStateAndResultJob;

    @Autowired
    private SyncActivityJob syncActivityJob;

    @Autowired
    private SyncTesteeUnSyncResultJob syncTesteeUnSyncResultJob;

    @Scheduled(cron="0 0/10 0,1,2,3,4,5,6,20,21,22,23 * * ? ")
    public void syncHuanghehrResume(){
        logger.info("ScheduleTask::syncHuanghehrResume 开始执行");
        huanghehrResumeJob.run();
    }

    /**
     * 每天00:05执行
     */
    @Scheduled(cron="0 5 0 * * ? ")
    public void syncTemplateJob(){
        logger.info("ScheduleTask::syncTemplateJob 开始执行");
        syncTemplateJob.run();
    }

    /**
     * 从第一分钟开始，每5分钟执行一次
     */
    @Scheduled(cron="0 1/5 * * * ? ")
    public void syncTesteeStateAndResultJob(){
        logger.info("ScheduleTask::syncTesteeStateAndResultJob 开始执行");
        syncTesteeStateAndResultJob.run();
    }

    /**
     * 从第二分钟开始，每5分钟执行一次
     */
    @Scheduled(cron="0 2/5 * * * ? ")
    public void syncTesteeUnSyncResultJob(){
        logger.info("ScheduleTask::syncTesteeUnSyncResultJob 开始执行");
        syncTesteeUnSyncResultJob.run();
    }


    /**
     * 从第二分钟开始，每5分钟执行一次
     */
    @Scheduled(cron="0 3/5 * * * ? ")
    public void SyncActivityJob(){
        logger.info("ScheduleTask::SyncActivityJob 开始执行");
        syncActivityJob.run();
    }




}
